import vueRouter from "vue-router"
import vue from "vue"
const Home = ()=>import('../views/home/Home.vue')
const Catalogue = ()=>import('../views/catalogue/Catalogue.vue')
const Shopping = ()=>import('../views/shopping/Shopping.vue')
const Me = ()=>import('../views/me/Me.vue')
const Details = ()=>import('../views/details/Details.vue')


vue.use(vueRouter)
const originalPush = vueRouter.prototype.push
vueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
    {
        path:'',
        redirect:"/home"
    },
    {
        path:'/home',
        component:Home
    },
    {
        path:'/catalogue',
        component:Catalogue
    },
    {
        path:'/shopping',
        component:Shopping
    },
    {
        path:'/me',
        component:Me
    },
    {
        path:'/details/:pops/:index',
        component:Details
    }
]
const router = new vueRouter({
    routes,
    mode:'history'
    // mode:'hash'
})

export default router